/*
This file is part of Docking@Home.
http://docking.gcl.cis.udel.edu
Copyright (C) 2009 University of Delaware

Docking@Home is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Docking@Home is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Docking@Home.  If not, see <http://www.gnu.org/licenses/>.
*/
/*
	Filename: Button.h
	Description: An abstract class (aka interface) that contains all necessary
		functions that any type of button that must implement.
	Revision History: 
		Created - 01/08/08
	Author: Robert Keller (01/08/08 -> current)
*/


#include "Button.h"

// ------------------------------------------------------------
// Static Variable Declarations
// ------------------------------------------------------------

GLHelper * Button::glHelper;

// ------------------------------------------------------------
// Constructor
// ------------------------------------------------------------

Button::Button () 
{
	state = UNSELECTED;
	
	bSelected = false;
	bHoldSelection = false;

	actionID = -1;

}// Button

// ------------------------------------------------------------
// Member Modifiers
// ------------------------------------------------------------

void Button::setName (const char n[BUTTON_MAX_NAME_LENGTH])
{
	memcpy(name, n, sizeof(char) * BUTTON_MAX_NAME_LENGTH);
}// setName

void Button::setPosition (float newX, float newY)
{
	x = newX;
	y = newY;
}// setPosition

void Button::setWidth (float w)
{
	width = w;
}// setWidth

void Button::setHeight (float h)
{
	height = h;
}// setHeight

void Button::select ()
{
	bSelected = true;
	state = SELECTED;
}// select

void Button::unselect ()
{
	bSelected = false;
	state = UNSELECTED;
}// unselect

void Button::setHoldSelection (bool hold)
{
	bHoldSelection = hold;
}// setHoldSelection

void Button::setSelectedColor (const float color[4])
{
	glHelper->copyColor4f(selectedColor, color);
}// setSelectedColor

void Button::setUnselectedColor (const float color[4])
{
	glHelper->copyColor4f(unselectedColor, color);
}// setUnselectedColor

void Button::setHoverColor (const float color[4])
{
	glHelper->copyColor4f(hoverColor, color);
}// setHoverColor

void Button::setActionID (int id)
{
	actionID = id;
}// setActionID

// ------------------------------------------------------------
// Member Accessors
// ------------------------------------------------------------

int Button::getActionID () const
{
	return actionID;
}// getActionID

bool Button::isSelected () const
{
	return bSelected;
}// isSelected

GUI_Element_State Button::getState () const
{
	return state;
}// getState
